package com.itheima.home_work.net_shop;

public class ProductSortMethods {
    // 按照价格排列展示[从小到大]
    public static int compareProductsByPrice(Product pd1, Product pd2) {
        int result = 0;
        result = Double.compare(pd1.getPrice(), pd2.getPrice());
        return result;
    }

    // 按照库存排列展示[从大到小]
    public int compareProductsByInventory(Product pd1, Product pd2) {
        return pd2.getInventory() - pd1.getInventory();
    }
}
